<template>

    <div style="height: 50px;line-height: 50px;border-bottom:1px solid #ccc;display: flex;">

        <div style="width: 199px;padding-left: 30px;font-weight: bold;color: cornflowerblue;background-color: rgb(84, 92, 100);">我的后台</div>
        <div style="flex: 1;">

        </div>
       <!-- <el-badge :value="3" class="item" style="height: 3px">
            <el-button size="small" style="height: 30px">回复</el-button>
        </el-badge>
        <el-badge :value="1" class="item" type="primary">
            <el-button size="small"  style="height: 30px">评论</el-button>
        </el-badge>-->
<div style="display: flex">
        <div style="margin: 5px 6px">
        <el-avatar  :src="form.avatar" ></el-avatar>
        <!--<img src="https://img2.baidu.com/it/u=2285567582,1185119578&fm=26&fmt=auto" />-->
        </div>
        <div >
            <el-dropdown trigger="click">

      <span class="el-dropdown-link">
          {{form.nick || '游客'}}
        <i class="el-icon-arrow-down el-icon--right"></i>
      </span>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item @click.native="$router.push('/store')">图书商城</el-dropdown-item>
                    <el-dropdown-item @click.native="$router.push('/person')">个人信息</el-dropdown-item>
                    <el-dropdown-item  @click.native="$router.push('/login')">退出系统</el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
</div>
    </div>
</template>

<script>
    import request from "@/utils/request";
    export default {
        name: "Header",
        data(){
            return{
                form:{avatar:'',username:''}
            }
        },
        created(){

            let str=sessionStorage.getItem("user")
            this.form=JSON.parse(str)
           /* if (this.form == null) {
                this.form.avatar='https://img2.baidu.com/it/u=2285567582,1185119578&fm=26&fmt=auto'
            }
            if (this.form == null) {
                this.form.username='游客'
            }
            console.log(this.form.avatar)*/
        },
        methods:{

        },


    }
</script>


<style>
    .item {

        margin-top: 8px;
        margin-right: 40px;

    }
</style>
